package com.danicsoft.daide.command;

import com.danicsoft.daide.token.TokenMap;
import com.danicsoft.daide.token.TokenGroup;

/**
 * Implements the OBS command. From Eric Wald's <a
 * href="http://pydip.brainshell.org/docs/syntax.html">protocol specification</a>,
 * v0.14:
 * <h4><a name="OBS">client_command = OBS [('name') ('version')]</a></h4>
 * <p>
 * This is sent by the client to the server in place of <b>NME</b>, to indicate
 * that the connected client is actually just an observer, and doesn't wish to
 * take part in the game. Observers are informed of the game progress as turns
 * process, but do not take any part in the game. The server will respond with
 * <b>YES (OBS ('name') ('version'))</b> if the name and version were
 * specified; <b>YES (OBS)</b> otherwise.
 * </p>
 * <p>
 * Note that this does not currently support Eric's suggested Name and Version
 * fields
 * </p>
 * 
 * @author Daniel Yule (daniel.yule@gmail.com)
 * @version 1.0
 */
public class ObserverCommand extends Command {

	// TODO Implement optional name and version fields.

	/**
	 * Construct a new <code>ObserverCommand</code> from the tokens given
	 * 
	 * @param tokens
	 *        The tokens to load from. Should be empty.
	 * @throws ParseException
	 *         If we could not load from the tokens given.
	 */
	public ObserverCommand(TokenGroup tokens) throws ParseException {
		super(tokens);
	}

	/**
	 * Create a new <code>ObserverCommand</code> for sending to the server.
	 */
	public ObserverCommand() {
		super();
	}

	@Override
	public byte getType() {
		return TokenMap.Commands.OBS;
	}

	@Override
	public String toString() {
		return "Observer";
	}

	public void doIO(TokenIO tokenIO, TokenGroup tokens) throws ParseException {

	}

}
